package ph.loong.deliveryman.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Author jc.lu.
 * Dates 2018/2/8.
 * Email Tbsupland@163.com.
 * desc
 */

public class LoginFragmentAdapter extends FragmentPagerAdapter {
    private final List<Fragment> mFragments;
    private String[] mTitles = new String[]{"密码登录", "短信登录"};

    public LoginFragmentAdapter(FragmentManager fm,List<Fragment> fragments) {
        super(fm);
        this.mFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments == null || mFragments.size() == 0 ? 0 : mFragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
